<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Layui</title>
<c:set var="basepath" scope="page"
	value="${pageContext.request.contextPath}"></c:set>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="${basepath}/static/layui/css/layui.css" media="all">

<!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
<!-- 上传文件 -->
	<button type="button" class="layui-btn" id="test1">
		<i class="layui-icon">&#xe67c;</i>上传图片
	</button>

	<table class="layui-hide" id="test" lay-filter="test"></table>
	<script src="${basepath}/static/layui/layui.js" charset="utf-8"></script>
	<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->

<!-- 文件上传 -->
	<script>
		layui.use(['upload','layer'], function() {
			var upload = layui.upload;
			var layer = layui.layer;

			//执行实例
			var uploadInst = upload.render({
				elem : '#test1' //绑定元素
				,
				url : 'ups.do' //上传接口
				,
				done : function(res) {
					//上传完毕回调
					layer.msg(res.msg);
				},
				error : function() {
					//请求异常回调
				}
			});
		});
	</script>
</body>
</html>